const judgeSquareSum = (target) => {
  let left = 0,
    right = Math.floor(Math.sqrt(target));
  while (left <= right) {
    const sum = left * left + right * right;
    if (sum === target) {
      return true;
    } else if (sum < target) {
      left++;
    } else {
      right--;
    }
  }
  return false;
};
